//
//  BaseResquestModel.m
//  TBNetworking_Example
//
//  Created by apple on 2018/8/8.
//  Copyright © 2018年 lzb. All rights reserved.
//

#import "BaseResquestModel.h"

@implementation BaseResquestModel

/**
 *  服务器需求地址url
 */
- (NSString *)url
{
    return @"";
}

/**
 *  网络请求模型参数转化为字典参数
 */
- (NSDictionary *)requestParamDictionary
{
    NSDictionary *keyValueDict = [self modelToDictionary];
    return  keyValueDict;
}



#pragma mark - AFNetworkRequestConfigProtocol
/**
 配置网络请求的URL
 */
- (NSString *)configRequestAPIURL
{
    return [self url];
}
/**
 *  请求所需要的参数
 *
 *  @return 参数字典
 */
- (NSDictionary *)configRequestParamDictionary
{
    return [self requestParamDictionary];
}
- (AFNetworkRequestMethod)configRequestMethod
{
    return AFNetworkRequestMethod_GET;
}

- (AFNetworkResponseSerializerType)configResponseSerializerType{
    return AFNetworkResponseSerializerType_JSON;
}

-(AFNetworkRequestSerializerType)configRequestSerializerType{
    return AFNetworkRequestSerializerType_JSON;
}


- (NSURLRequestCachePolicy)confgiCachePolicy
{
    return NSURLRequestReloadIgnoringCacheData;
}

- (NSTimeInterval)configRequestTimeoutInterval
{
    return 30.0f;
}

/**
 服务接口 Acceptable-Content 配置
 
 @return Acceptable-Content Types;
 */
- (NSSet<NSString *> *)configResponseAcceptableContentTypes
{
    return [NSSet setWithObjects:
            @"application/json",
            @"text/html",
            @"image/jpeg",
            @"image/png",
            @"application/octet-stream",
            @"text/json",
            nil];;
}


/**
 配置响应队列 默认是主队列
 
 @return
 */
- (dispatch_queue_t)configResponsequeue
{
    return dispatch_get_main_queue();
}

/**
 配置请求失败默认文字
 
 */
- (NSString *)configRequestFailDefaultMessage
{
    return @"服务器努力抢救中，请稍后再试";
}
@end
